package com.millstein.vo;

import com.millstein.constant.OrderConstant;
import com.millstein.model.ProductOrderItemDO;
import com.millstein.request.AddOrderRequest;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;

/**
 * @description:
 * @author: tsing
 * @create: 2021-09-29 14:52
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PayInfoVO {
    // 订单编号
    private String outTradeNo;
    // 订单金额
    private BigDecimal payFee;
    // 支付类型
    private String payType;
    // 客户端类型
    private String clientType;
    // 商品名称
    private String title;
    // 商品介绍
    private String description;
    // 支付的超时时间
    private long orderPayTimeoutMills;

    public PayInfoVO(AddOrderRequest addOrderRequest, String outTradeNo, ProductOrderItemDO item,
                     Long timeout) {
        this.outTradeNo = outTradeNo;
        this.payFee = addOrderRequest.getActualAmount();
        this.payType = addOrderRequest.getPayType();
        this.clientType = addOrderRequest.getClientType();
        this.title = item.getProductName();
        this.description = item.getProductName();
        this.orderPayTimeoutMills = timeout == null ? OrderConstant.DEFAULT_ORDER_PAY_TIME_OUT : timeout;
    }
}
